﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" import="java.sql.*"%>
<%@ page import="ookweb.Conn"%>
<%@ page import="ookweb.*"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/ookweb/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>东方通网站管理</title>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style>
<script src="<%=basePath%>js/jquery-1.5.1.min.js"  type="text/javascript" ></script>
</head>

<body>
<%
String strUserName=(String)request.getParameter("username");
String strPassword=(String)request.getParameter("password");

String message="";
if("".equals(strUserName) ||  strUserName==null || "".equals(strPassword) ||  strPassword==null){
 message="请输入用户名和密码."; 
}else{  

String dbuser = application.getInitParameter("dbuser");
String dbpass = application.getInitParameter("dbpass");
String dburl = application.getInitParameter("dburl");
Conn con=new Conn(dbuser,dbpass,dburl);
        ResultSet rs=con.getRs("select userid from  web_manage where username='"+strUserName+"' and userpass='"+strPassword+"'");
        if(rs.next()){
                session.setAttribute("ookweb_m_username",strUserName);
                session.setAttribute("ookweb_m_password",strPassword);
                session.setAttribute("ookweb_m_userid",rs.getString("userid"));
                response.sendRedirect("index.jsp");
        }else{
            message="你输入的用户名或密码错误.";   
        }
   
		
}
%> 
<div align="center">
<form action="login.jsp" method="post" id="logfrm">
<table width="543" border="0" align="center" cellpadding="0" cellspacing="0" background="../images/login.jpg" >
  <tr>
    <td width="523" height="387" align="center" valign="top"  ><table width="100%" border="0">
      <tr>
        <td width="49%" height="122" align="right" valign="top"><a href="<%=basePath%>" style=" display:block; float:right; height:80px; width:220px;"></a></td>
        <td width="51%" align="right" valign="top"><a href="javascript:window.close()" style=" display:block; float:right; height:40px; width:60px;"></a></td>
      </tr>
    </table>
      <table width="358" height="219" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td width="67" height="79">&nbsp;</td>
        <td width="291" align="left" valign="bottom"><label>
          <input type="text" name="username" id="username" style=" border:1px solid #ccc; width:200px;" value=""/>
        </label></td>
      </tr>
      <tr>
        <td height="24">&nbsp;</td>
        <td align="left">&nbsp;</td>
      </tr>
      <tr>
        <td height="35">&nbsp;</td>
        <td align="left" valign="bottom"><input type="password" name="password" id="password" style=" border:1px solid #ccc;width:200px;" value=""/></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td height="48" colspan="2"><table width="358" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td height="46" align="center" valign="top"><img  src="../images/cmd.gif" name="logincmd" width="97" height="26" id="logincmd" style=" cursor:pointer;" /></td>
            <td align="center" valign="top"><img src="../images/cmd.gif"  style=" cursor:pointer;"  width="108" height="31" onclick="window.location.reload()" /></td>
          </tr>
        </table></td>
        </tr>
    </table></td>
  </tr>
</table>
</form>
<script type="text/javascript">
$(function(){
  $("#logincmd").click(function(){
   var u=$("#username").attr("value");
   var p=$("#password").attr("value");
   if(u=='' || p==''){
  alert('请输入用户名或密码');
   }else{
    $("#logfrm").submit();
  }
  });
});
</script>
</div>
</body>
</html>

